<script type="text/javascript">
$(document).ready(function(){
	$("#frmSearch").submit(function(){
		var keyword = $("#keyword").attr("value");
		if( keyword == '' || keyword == "Tìm sản phẩm..."){
			alert("Bạn cần nhập từ khóa tìm kiếm!");
			return false;
		}
	});
});
</script>
<div id="main_content">
        	
			<div id="view_post_box">
            	<div id="title_view_post_box"><?php echo $this->post['title'];?></div>
                <div id="content_post_box">
                	<img src="<?php echo $this->post['feature_image'];?>" align ="left" style="margin: 10px 15px 15px 10px;"/>
					<?php echo $this->post['content'];?>

                </div>
                
				<div style="clear: both;"></div>
            </div>
           
</div><!-- end main_content block -->
        <div id="right">
        	<div id="search_box">
        		<form id="frmSearch" action="<?php echo $this->url(array(), "search");?>" method="get">
        			<input type="text" onclick="value='';"  id="keyword" name="keyword" value="Tìm sản phẩm..."/>
                	<input type="submit" id="submit_button" value="Tìm kiếm" />
        		</form>
            	
            </div><!-- end search_block-->
            <div id="cart_box">
            	<div id="title_cart"><a href="<?php echo $this->url(array(),"cart");?>">Giỏ hàng của bạn</a></div>
                <div class="cart_info">
                	<span class="left_info">Số sản phẩm:&nbsp; </span>
                    <span class="right_info"><?php echo $this->totalCartProduct;?></span>
                </div>
                <div class="cart_info">
                	<span class="left_info">Tổng tiền:&nbsp;</span>
                    <span class="right_info"><?php echo number_format($this->totalCartPrice);?> VND</span>
                </div>
            </div> <!-- end cart_block -->
            <?php
            //lấy dữ liệu để điền vào 2 box hỗ trợ trực tuyến
            $arrSalers = array();
            $arrTechnicians = array(); 
            foreach ($this->supporters as $supporter){
            	if($supporter->type == 0){
            		$arrSalers[] = $supporter;
            	}else{
            		$arrTechnicians[] = $supporter;
            	}
            }
            
                  
            ?>
            <div class="right_box">
            	<div class="title_box">
                	<div class="text_title_box">Bán hàng trực tuyến</div>
                    <div class="phone_title_box">(04) 35 68 36 99</div>
                </div>
                <?php $count_business =count($arrSalers);
               	if($count_business>0){
               	for( $i=0;$i<$count_business;$i++){?>
               	 <div class="supporter">
                	<div class="info_supporter">
                    	<div class="name_supporter">
                        	<a href="ymsgr:SendIM?<?php echo $arrSalers[$i]->yahoo_account;?>"  title="Contact to supporter!">
         						<?php echo $arrSalers[$i]->name;?>
                            </a>
                            </div>
                       	<div class="phone_supporter"><?php echo $arrSalers[$i]->phone;?></div>
                        <div class="email_supporter"><?php echo $arrSalers[$i]->email;?></div>
                        
                    </div>
                    <a href="ymsgr:SendIM?<?php echo $arrSalers[$i]->yahoo_account;?>"  title="Contact to supporter!">
                            <img  alt="" src="http://opi.yahoo.com/online?u=<?php echo $arrSalers[$i]->yahoo_account;?>&m=g&t=1" border="0"/>
                        </a>
                    <?php if($i+2 <= $count_business){?><div class="line"></div><?php } ?>
                </div>
               <?php }
               	 } ?>
                
               
            </div><!-- end right_box-->           
            <div class="right_box">
            	<div class="title_box">
                	<div class="text_title_box">Hỗ trợ kỹ thuật</div>
                    <div class="phone_title_box">(04) 66 84 87 86</div>
                </div>
                <?php $count_technical =count($arrTechnicians);
               	if($count_technical>0){
               	for( $i=0;$i<$count_technical;$i++){?>
               	 <div class="supporter">
                	<div class="info_supporter">
                    	<div class="name_supporter">
                        	<a href="ymsgr:SendIM?<?php echo $arrTechnicians[$i]->yahoo_account;?>"  title="Contact to supporter!">
         						<?php echo $arrTechnicians[$i]->name;?>
                            </a>
                            </div>
                        <div class="phone_supporter"><?php echo $arrTechnicians[$i]->phone;?></div>
                        <div class="email_supporter"><?php echo $arrTechnicians[$i]->email;?></div>
                        
                    </div>
                    <div class="online_icon"><img  src="http://opi.yahoo.com/online?u=<?php echo $arrTechnicians[$i]->yahoo_account;?>&m=g&t=1" border="0"></div>
                    <?php if($i+2 <= $count_technical){?><div class="line"></div><?php } ?>
                </div>
               <?php }
               	 } ?>
            </div><!-- end right_box-->
             <?php
                if (isset($this->relatePosts) && count($this->relatePosts) > 0 ){
            ?>
            <div class="right_box">
            	<div class="title_box">
                	<div class="text_title_box">Các bài viết liên quan</div>
                </div>
                <div class="news_box">
               
                <?php 	
                foreach ($this->relatePosts as $relatePost){	
                ?>
                <div class="news_link"><a href="<?php echo $this->url(array('slug' => $relatePost->slug),'post');?>"><?php echo $relatePost->title;?></a></div>
                <?php
                }
                ?>
                <div class="view_all"><a href="<?php echo $this->url(array('page' => '', 'name' => Helper_Converter::stringToSlug($this->relateCategory['name']), 'id' => $this->relateCategory['id']), 'category');?>">Xem tất cả&gt;&gt;&gt;</a></div>                    
                </div>
            </div><!-- end right_box-->

            <?php } ?>
                        <?php
            echo $this->partial("include/tags.phtml", array("tags" => $this->tags));
            ?>
        </div><!-- end right block -->
        <div id="clear"></div>